package c.c.b.b.d;

import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.text.TextUtils;
import android.widget.ImageView.ScaleType;
import c.c.b.b.d.k.a;
import c.c.b.b.d.k.c;
import c.c.b.b.d.k.d;

/* compiled from: ImageLoader */
public class f implements Runnable {
    public final /* synthetic */ String a;
    public final /* synthetic */ d b;
    public final /* synthetic */ int c;
    public final /* synthetic */ int d;
    public final /* synthetic */ ScaleType e;
    public final /* synthetic */ k f;

    public f(k kVar, String str, d dVar, int i, int i2, ScaleType scaleType) {
        this.f = kVar;
        this.a = str;
        this.b = dVar;
        this.c = i;
        this.d = i2;
        this.e = scaleType;
    }

    public void run() {
        k kVar = this.f;
        String str = this.a;
        d dVar = this.b;
        int i = this.c;
        int i2 = this.d;
        ScaleType scaleType = this.e;
        kVar.g.post(new g(kVar, dVar));
        String a = kVar.d.a(str, i, i2, scaleType);
        if (TextUtils.isEmpty(a)) {
            StringBuilder stringBuilder = new StringBuilder(str.length() + 12);
            stringBuilder.append("#W");
            stringBuilder.append(i);
            stringBuilder.append("#H");
            stringBuilder.append(i2);
            stringBuilder.append("#S");
            stringBuilder.append(scaleType.ordinal());
            stringBuilder.append(str);
            a = stringBuilder.toString();
        }
        String str2 = a;
        Bitmap a2 = kVar.d.a(str2);
        if (a2 != null) {
            kVar.g.post(new h(kVar, dVar, new c(kVar, a2, str, null, null)));
            return;
        }
        c cVar = new c(kVar, null, str, str2, dVar);
        a aVar = (a) kVar.e.get(str2);
        if (aVar == null) {
            aVar = (a) kVar.f.get(str2);
        }
        if (aVar != null) {
            aVar.d.add(cVar);
            return;
        }
        c cVar2 = cVar;
        l lVar = new l(str, new i(kVar, str2), i, i2, scaleType, Config.ARGB_4444);
        kVar.b.a(lVar);
        kVar.e.put(str2, new a(lVar, cVar2));
    }
}
